package com.xxxx.server.controller;


import com.xxxx.server.basic.EmpBean;
import com.xxxx.server.pojo.RespBean;
import com.xxxx.server.pojo.Salary;
import com.xxxx.server.service.ISalaryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  薪酬管理模块
 * </p>
 *
 * @author zhoubin
 * @since 2020-10-15
 */
@RestController
@RequestMapping("/salary")
public class SalaryController {

    @Resource
    private ISalaryService iSalaryService;



    @ApiOperation("查看所有工资账套")
    @GetMapping("/sob/")
    public List<Salary> selectAllSob(){

        return iSalaryService.selectAllSob();
    }

    @ApiOperation("添加工资账套")
    @PostMapping("/sob/")
    public RespBean addSob(@RequestBody Salary salary){
       return iSalaryService.addSob(salary);
    }

    @ApiOperation("编辑工资账套")
    @PutMapping("/sob/")
    public RespBean updateSob(@RequestBody Salary salary){
        return iSalaryService.updateSob(salary);
    }

    @ApiOperation("删除工资账套")
    @DeleteMapping("/sob/{id}")
    public RespBean deleteSob(@PathVariable Integer id){
        return iSalaryService.deleteSob(id);
    }

    @ApiOperation("查询出所有的账套信息")
    @GetMapping("/sobcfg/salaries")
    @ResponseBody
    public List<Salary> selectAllSalarys(){
        return iSalaryService.selectAllSalarys();
    }

    @ApiOperation("修改关联的工资账套")
    @PutMapping("/sobcfg/")
    public RespBean updateSobCfg(Integer eid,Integer sid){
        return iSalaryService.updateSobCfg(eid,sid);
    }

    @ApiOperation("查询所需的员工信息")
    @GetMapping("/sobcfg/")
    public EmpBean pageHandler(Integer currentPage, Integer size){
        return iSalaryService.pageHandler(currentPage,size);
    }

}
